//	ID : pallab81
// 	PROG : tri
// 	LANG : C++
// 	2011-07-18-20.43.47 Monday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

Int grid[800][800];
Int k_value[700];

int N,K;
inline void print(){
    int i,j;
    for(i=1;i<=N;++i){
        for(j=1;j<=i;++j){
            printf("%lld\t",grid[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}
inline void pre(){
    SET(k_value,0);
    int i;
    for(i=1;i<=700;++i){
        k_value[i] = k_value[i-1]+i;
    }
}
inline void read(){
    SET(grid,0);
    scanf("%d %d",&N,&K);
    int i,j;
    for(i=1;i<=N;++i){
        for(j=1;j<=i;++j){
            scanf("%lld",&grid[i][j]);
        }
    }
}
inline void sum_up(){
    int i,j;
    for(i=1;i<=N;++i){
        for(j=1;j<=i;++j){
            grid[i][j] = grid[i][j]+grid[i-1][j-1];
        }
    }
}
inline bool good1(int r, int c, int k){
    return (r-k+1 >=1 && c+k-1<=r);
}
inline bool good2(int r, int c, int k){
    return (r+k-1<=N && c+k-1<=r);
}
inline Int calc1(int r, int c, int k){
    Int sum=0;
    for(int i=1;i<=k;++i){
        int now_c = c+i-1;
        Int var = grid[r][now_c]-grid[r-i][now_c-i];
        sum+=var;
    }
return (Int)sum/k_value[k];
}
inline Int calc2(int r, int c, int k){
    Int sum=0;
    for(int i=1,j=k;i<=k;++i,--j){
        int now_c = c+i-1;
        Int var = grid[r+j-1][now_c+j-1] - grid[r-1][now_c-1];
        sum+=var;
    }
return (Int)sum/k_value[k];
}
inline void proc(){
    int i,j;
    Int best = (Int)-1e18;
    for(i=1;i<=N;++i){
        for(j=1;j<=i;++j){
            for(int k=K;k<=20;++k){
                if(good1(i,j,k)==false){
                    break;
                }
                Int var = calc1(i,j,k);
                //printf("%d %d %d %lld\n",i,j,k,var);
                best = max(best, var);
            }
            for(int k=K;k<=20;++k){
                if(good2(i,j,k)==false){
                    break;
                }
                Int var = calc2(i,j,k);
                best = max(best,var);
            }
        }
    }
    printf("%lld\n",best);
}

int main(){
        pre();
        freopen("tri.in","rt",stdin);
        freopen("tri.out","wt",stdout);
        read();
        sum_up();
        proc();

return 0;
}


